package com.ip.student.models.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ip.common.dto.BaseDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("student_info")
@ApiModel(value="学生基本信息对象", description="学生基本信息对象")
public class StudentInfoDTO extends BaseDTO implements Serializable {

    // 标记为非数据库字段
    @TableField(exist = false)
    protected Long id;

    // 标记为非数据库字段
    @TableField(exist = false)
    private Integer revision;

    // 标记为非数据库字段
    @TableField(exist = false)
    protected Date createTime;

    // 标记为非数据库字段
    @TableField(exist = false)
    protected Date updateTime;
    
    @TableId(value = "student_id", type = IdType.INPUT)
    private Integer studentId;
    
    @ApiModelProperty(value = "所属班级ID")
    private Integer classId;
    @ApiModelProperty(value = "学生姓名")
    private String studentName;
    @ApiModelProperty(value = "曾用名")
    private String formerName;
    @ApiModelProperty(value = "身份证号")
    private String idCard;
    @ApiModelProperty(value = "全国学号")
    private String nationalStudentId;
    @ApiModelProperty(value = "校内学号")
    private String schoolStudentId;
    @ApiModelProperty(value = "性别")
    private String gender;
    @ApiModelProperty(value = "出生年月")
    private Date birthDate;
    @ApiModelProperty(value = "民族")
    private String nationality;
    @ApiModelProperty(value = "入学方式")
    private String admissionMethod;
    @ApiModelProperty(value = "户口类型")
    private String householdType;
    @ApiModelProperty(value = "户籍地址")
    private String householdAddress;
    @ApiModelProperty(value = "现居住地址")
    private String residenceAddress;
    @ApiModelProperty(value = "监护人姓名")
    private String guardianName;
    @ApiModelProperty(value = "与学生关系")
    private String guardianRelation;
    @ApiModelProperty(value = "监护人手机号")
    private String guardianPhone;
    @ApiModelProperty(value = "学生状态")
    private String studentStatus;
    
    // Override the id field from BaseDTO since this table doesn't have an 'id' column
    @JSONField(serializeUsing = ToStringSerializer.class)
    public void setId(Long id) {
        this.id = id;
    }
    
    @JSONField(serializeUsing = ToStringSerializer.class)
    public Long getId() {
        return this.studentId != null ? this.studentId.longValue() : null;
    }
}